#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
void reverse(char* p) {
    if (!*p)return;
    char t = *p;
    int len = strlen(p);
    *p = p[len - 1];
    p[len - 1] = 0;
    reverse(p + 1);
    p[len - 1] = t;
}
int main() {
    char A[100010];
    int B, C[100010];
    scanf("%s %d", A, &B);
    if (!B || !strcmp(A, "0")) {
        printf("0");
        return 0;
    }
    reverse(A);
    int i, t, k;
    for (i = t = k = 0; i < (int)strlen(A); i++) {
        k = (A[i] - '0') * B + t;
        t = k / 10;
        k %= 10;
        C[i] = k;
    }
    C[i] = t;
    for (int j = i; j >= 0; j--) {
        if (j == i)if (!C[j])continue;
        printf("%d", C[j]);
    }
    return 0;
}